# -*- coding: UTF-8 -*-
'''
Created on 2011-8-21

@author: zxz
'''
from flaskext.wtf import Form, TextField, IntegerField, Required, validators
from wtforms.validators import ValidationError

def content_not_null(form, field):
    if field.data is not None:
        field.data = field.data.strip()
    if field.data == None or len(field.data) < 1 or len(field.data) > 500:
        raise ValidationError(u'姓名长度在2-500之间')

class CommentsForm(Form):
    sid = IntegerField(u'stream ID', validators=[validators.required()])
    content = TextField(u'内容', validators=[content_not_null])
